<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/themes/bootstrap/easyui.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/themes/icon.css"/>

<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
<script type="text/javascript">
	$(function(){
		$.ajax({
			type: 'post',
			url: '${pageContext.request.contextPath}/showFirstFuncAction',
			dataType: 'json',
			success: function(data){
				$.each(data, function(i,v){
					$("#selectBox").append("<option value="+v.fname+">"+v.fname+"</option>");
				});
			}
		});
	});
</script>

</head>
<body class="container">
	<div class="btn-group-vertical" style="padding-top:50px">
		<button type="button" class="btn btn-default" data-toggle="modal" data-target=".bs-example-modal-lg1">添加一级菜单</button>
	  	<button type="button" class="btn btn-default" data-toggle="modal" data-target=".bs-example-modal-lg2">添加二级菜单</button>
		<p style="color: red">${msg }</p>
	</div>
	
	<div class="modal fade bs-example-modal-lg1" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
	  <div class="modal-dialog modal-lg">
	    <div class="modal-content">
	      	<form class="form-horizontal" action="${pageContext.request.contextPath}/addFuncAction" method="post">
			  <div class="form-group">
			    <label class="col-md-2 control-label">功能名字</label>
			    <div class="col-md-10">
			      <input type="text" class="form-control" name="fname">
			    </div>
			  </div>
			  <div class="form-group">
			    <label class="col-md-2 control-label">功能路径</label>
			    <div class="col-md-10">
			      <input type="text" class="form-control" name="fpath">
			    </div>
			  </div> 
			  <div class="form-group">
			    <div class="col-md-offset-1 col-md-10" style="text-align: center">
			      <button id="addButton1" type="submit" class="btn btn-default">确定</button>
			    </div>
			  </div>
			</form>
	    </div>
	  </div>
	</div>   
	
	<div class="modal fade bs-example-modal-lg2" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
	  <div class="modal-dialog modal-lg">
	    <div class="modal-content">
	      	<form class="form-horizontal" action="${pageContext.request.contextPath}/addFuncAction" method="post">
		   	 
		   	  <h3><span>请选择一级功能</span></h3>      
			  <span style="margin-left:100px;width:18px;overflow:hidden;">      
			  <select id="selectBox" style="width:118px;margin-left:-100px" onchange="this.parentNode.nextSibling.value=this.value">            
			  </select></span><input name="box" style="width:100px;height:20px; position:absolute;left:0px;">      
			 
			  <div class="form-group">
			    <label class="col-md-2 control-label">功能名字</label>
			    <div class="col-md-10">
			      <input type="text" class="form-control" name="fname">
			    </div>
			  </div>
			  <div class="form-group">
			    <label class="col-md-2 control-label">功能路径</label>
			    <div class="col-md-10">
			      <input type="text" class="form-control" name="fpath">
			    </div>
			  </div> 
			  <div class="form-group">
			    <div class="col-md-offset-1 col-md-10" style="text-align: center">
			      <button id="addButton2" type="submit" class="btn btn-default">确定</button>
			    </div>
			  </div>
			</form>
	    </div>
	  </div>
	</div>
</body>
</html>